Handle case where we need to parse the xsetting as if it were an RC file
authorHavoc Pennington <hp@redhat.com>
Mon, 4 Jun 2001 23:15:51 +0000 (23:15 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Mon, 4 Jun 2001 23:15:51 +0000 (23:15 +0000)
2001-05-10  Havoc Pennington  <hp@redhat.com>

* gtk/gtksettings.c (gtk_settings_get_property): Handle case where
we need to parse the xsetting as if it were an RC file string.

* gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
value of palette from settings, not from static variable

* gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
xsettings translation table

* gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because
hardcoding the toolbar style conflicts with new customizable
toolbar style philosophy
(gtk_toolbar_class_init): add settings for default toolbar style;
these are used unless the app specifically forces a toolbar style

* gtk/gtksettings.c (settings_install_property_parser): only
return at the start if we warn and parser == NULL

* gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
palette changed handler so we don't notify dead color selections

* gtk/gtkstyle.c (gtk_default_draw_shadow): handle
xthickness/ythickness of 0 or 1 properly
(gtk_default_draw_resize_grip): clear the background behind the
resize grips, and align to bottom right if we square the
area to be drawn.

* gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on
statusbar label to 1, so it doesn't make toplevels resize oddly
(gtk_statusbar_size_request): add grip size to request
(gtk_statusbar_size_allocate): hack so the hbox still works with
the grip size in the request

* gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix
bug where showing all on a toplevel makes the toolbar
button text appear despite the toolbar mode

* gtk/gtkmenubar.c: add internal padding style property

* gtk/gtktoolbar.c: Add internal padding style property; add
shadow type style property

* gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
state; and put Container::border_width outside the frame

* gtk/gtktextview.c: don't draw focus rectangle if we're in
interior focus mode, we just use blinking cursor

27 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
demos/gtk-demo/Makefile.am
demos/gtk-demo/appwindow.c [new file with mode: 0644]
demos/gtk-demo/gtk-logo-rgb.gif
docs/Changes-2.0.txt
docs/reference/gtk/tmpl/gtk-unused.sgml
docs/reference/gtk/tmpl/gtktoolbar.sgml
docs/reference/gtk/tmpl/gtktypeutils.sgml
gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-util.c
gdk/x11/gdkevents-x11.c
gtk/gtkcolorsel.c
gtk/gtkiconfactory.c
gtk/gtkmenubar.c
gtk/gtksettings.c
gtk/gtkstatusbar.c
gtk/gtkstyle.c
gtk/gtktextview.c
gtk/gtktoolbar.c
gtk/gtktoolbar.h
tests/testgtk.c

index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index c4a2c973df958f0f5a422834ec091cea1a3342c1..2cb0df82d24a686c633b19d3242556aba384c997 100644 (file)
@@ -1,3 +1,53 @@
+2001-05-10  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtksettings.c (gtk_settings_get_property): Handle case where
+       we need to parse the xsetting as if it were an RC file string.
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
+       value of palette from settings, not from static variable
+
+       * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
+       xsettings translation table
+
+       * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because 
+       hardcoding the toolbar style conflicts with new customizable 
+       toolbar style philosophy
+       (gtk_toolbar_class_init): add settings for default toolbar style;
+       these are used unless the app specifically forces a toolbar style
+
+       * gtk/gtksettings.c (settings_install_property_parser): only
+       return at the start if we warn and parser == NULL
+
+       * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
+       palette changed handler so we don't notify dead color selections
+
+       * gtk/gtkstyle.c (gtk_default_draw_shadow): handle
+       xthickness/ythickness of 0 or 1 properly 
+       (gtk_default_draw_resize_grip): clear the background behind the
+       resize grips, and align to bottom right if we square the 
+       area to be drawn.
+
+       * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on 
+       statusbar label to 1, so it doesn't make toplevels resize oddly
+       (gtk_statusbar_size_request): add grip size to request
+       (gtk_statusbar_size_allocate): hack so the hbox still works with 
+       the grip size in the request
+
+       * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix 
+       bug where showing all on a toplevel makes the toolbar 
+       button text appear despite the toolbar mode
+
+       * gtk/gtkmenubar.c: add internal padding style property
+
+       * gtk/gtktoolbar.c: Add internal padding style property; add
+       shadow type style property
+
+       * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
+       state; and put Container::border_width outside the frame
+
+       * gtk/gtktextview.c: don't draw focus rectangle if we're in
+       interior focus mode, we just use blinking cursor
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: Make gdk-pixbuf have same version number as GTK
index a25c647dd6ac981d4be3d7a3869d31837e5f2b4d..0cfcbd76fad128e3629b2ef066aca85a76ba3c17 100644 (file)
@@ -5,6 +5,7 @@ democodedir=$(datadir)/gtk-2.0/demo
 ## These should be in the order you want them to appear in the 
 ## demo app, which means alphabetized by demo title, not filename
 demos = @STRIP_BEGIN@  \
+       appwindow.c     \
        button_box.c    \
        colorsel.c      \
        dialog.c        \
diff --git a/demos/gtk-demo/appwindow.c b/demos/gtk-demo/appwindow.c
new file mode 100644 (file)
index 0000000..75c898a
--- /dev/null
@@ -0,0 +1,342 @@
+/* Application main window
+ *
+ * Demonstrates a typical application window, with menubar, toolbar, statusbar.
+ */
+
+#include <gtk/gtk.h>
+
+static GtkWidget *window = NULL;
+
+
+static void
+menuitem_cb (gpointer             callback_data,
+             guint                callback_action,
+             GtkWidget           *widget)
+{
+  GtkWidget *dialog;
+  
+  dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_INFO,
+                                   GTK_BUTTONS_CLOSE,
+                                   "You selected or toggled the menu item: \"%s\"",
+                                    gtk_item_factory_path_from_widget (widget));
+
+  /* Close dialog on user response */
+  g_signal_connectc (G_OBJECT (dialog),
+                     "response",
+                     G_CALLBACK (gtk_widget_destroy),
+                     NULL,
+                     FALSE);
+  
+  gtk_widget_show (dialog);
+}
+
+
+static GtkItemFactoryEntry menu_items[] =
+{
+  { "/_File",            NULL,         0,                     0, "<Branch>" },
+  { "/File/tearoff1",    NULL,         menuitem_cb,       0, "<Tearoff>" },
+  { "/File/_New",        "<control>N", menuitem_cb,       0, "<StockItem>", GTK_STOCK_NEW },
+  { "/File/_Open",       "<control>O", menuitem_cb,       0, "<StockItem>", GTK_STOCK_OPEN },
+  { "/File/_Save",       "<control>S", menuitem_cb,       0, "<StockItem>", GTK_STOCK_SAVE },
+  { "/File/Save _As...", NULL,         menuitem_cb,       0, "<StockItem>", GTK_STOCK_SAVE },
+  { "/File/sep1",        NULL,         menuitem_cb,       0, "<Separator>" },
+  { "/File/_Quit",       "<control>Q", menuitem_cb,       0, "<StockItem>", GTK_STOCK_QUIT },
+
+  { "/_Preferences",                   NULL, 0,               0, "<Branch>" },
+  { "/_Preferences/_Color",            NULL, 0,               0, "<Branch>" },
+  { "/_Preferences/Color/_Red",        NULL, menuitem_cb, 0, "<RadioItem>" },
+  { "/_Preferences/Color/_Green",      NULL, menuitem_cb, 0, "/Preferences/Color/Red" },
+  { "/_Preferences/Color/_Blue",        NULL, menuitem_cb, 0, "/Preferences/Color/Red" },
+  { "/_Preferences/_Shape",            NULL, 0,               0, "<Branch>" },
+  { "/_Preferences/Shape/_Square",      NULL, menuitem_cb, 0, "<RadioItem>" },
+  { "/_Preferences/Shape/_Rectangle",   NULL, menuitem_cb, 0, "/Preferences/Shape/Square" },
+  { "/_Preferences/Shape/_Oval",        NULL, menuitem_cb, 0, "/Preferences/Shape/Rectangle" },
+
+  { "/_Help",            NULL,         0,                     0, "<LastBranch>" },
+  { "/Help/_About",      NULL,         menuitem_cb,       0 },
+};
+
+static void
+toolbar_cb (GtkWidget *button,
+            gpointer   data)
+{
+  GtkWidget *dialog;
+  
+  dialog = gtk_message_dialog_new (GTK_WINDOW (data),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_INFO,
+                                   GTK_BUTTONS_CLOSE,
+                                   "You selected a toolbar button");
+
+  /* Close dialog on user response */
+  g_signal_connectc (G_OBJECT (dialog),
+                     "response",
+                     G_CALLBACK (gtk_widget_destroy),
+                     NULL,
+                     FALSE);
+  
+  gtk_widget_show (dialog);
+}
+
+/* This function registers our custom toolbar icons, so they can be themed.
+ *
+ * It's totally optional to do this, you could just manually insert icons
+ * and have them not be themeable, especially if you never expect people
+ * to theme your app.
+ */
+static void
+register_stock_icons (void)
+{
+  static gboolean registered = FALSE;
+  
+  if (!registered)
+    {
+      GdkPixbuf *pixbuf;
+      GtkIconFactory *factory;
+
+      static GtkStockItem items[] = {
+        { "demo-gtk-logo",
+          "_GTK!",
+          0, 0, NULL }
+      };
+      
+      registered = TRUE;
+
+      /* Register our stock items */
+      gtk_stock_add (items, G_N_ELEMENTS (items));
+      
+      /* Add our custom icon factory to the list of defaults */
+      factory = gtk_icon_factory_new ();
+      gtk_icon_factory_add_default (factory);
+
+      /* Try current directory */
+      pixbuf = gdk_pixbuf_new_from_file ("./gtk-logo-rgb.gif", NULL);
+
+      /* Try install directory */
+      if (pixbuf == NULL)
+        pixbuf = gdk_pixbuf_new_from_file (DEMOCODEDIR"/gtk-logo-rgb.gif", NULL);
+
+      /* Register icon to accompany stock item */
+      if (pixbuf != NULL)
+        {
+          GtkIconSet *icon_set;
+          GdkPixbuf *transparent;
+
+          /* The gtk-logo-rgb icon has a white background, make it transparent */
+          transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
+          
+          icon_set = gtk_icon_set_new_from_pixbuf (transparent);
+          gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
+          gtk_icon_set_unref (icon_set);
+          g_object_unref (G_OBJECT (pixbuf));
+          g_object_unref (G_OBJECT (transparent));
+        }
+      else
+        g_warning ("failed to load GTK logo for toolbar");
+      
+      /* Drop our reference to the factory, GTK will hold a reference. */
+      g_object_unref (G_OBJECT (factory));
+    }
+}
+
+static void
+update_statusbar (GtkTextBuffer *buffer,
+                  GtkStatusbar  *statusbar)
+{
+  gchar *msg;
+  gint row, col;
+  gint count;
+  GtkTextIter iter;
+  
+  gtk_statusbar_pop (statusbar, 0); /* clear any previous message, underflow is allowed */
+
+  count = gtk_text_buffer_get_char_count (buffer);
+
+  gtk_text_buffer_get_iter_at_mark (buffer,
+                                    &iter,
+                                    gtk_text_buffer_get_insert (buffer));
+
+  row = gtk_text_iter_get_line (&iter);
+  col = gtk_text_iter_get_line_offset (&iter);
+
+  msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
+                         row, col, count);
+
+  gtk_statusbar_push (statusbar, 0, msg);
+
+  g_free (msg);
+}
+
+static void
+mark_set_callback (GtkTextBuffer     *buffer,
+                   const GtkTextIter *new_location,
+                   GtkTextMark       *mark,
+                   gpointer           data)
+{
+  update_statusbar (buffer, GTK_STATUSBAR (data));
+}
+
+GtkWidget *
+do_appwindow (void)
+{  
+  if (!window)
+    {
+      GtkWidget *table;
+      GtkWidget *toolbar;
+      GtkWidget *statusbar;
+      GtkWidget *contents;
+      GtkWidget *sw;
+      GtkTextBuffer *buffer;
+      GtkAccelGroup *accel_group;      
+      GtkItemFactory *item_factory;
+
+      register_stock_icons ();
+      
+      /* Create the toplevel window
+       */
+      
+      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+      gtk_window_set_title (GTK_WINDOW (window), "Application Window");
+
+      /* NULL window variable when window is closed */
+      g_signal_connectc (G_OBJECT (window), "destroy",
+                         G_CALLBACK (gtk_widget_destroyed),
+                         &window, TRUE);
+
+      table = gtk_table_new (1, 4, FALSE);
+      
+      gtk_container_add (GTK_CONTAINER (window), table);
+      
+      /* Create the menubar
+       */
+      
+      accel_group = gtk_accel_group_new ();
+      gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
+      gtk_accel_group_unref (accel_group);
+      
+      item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
+
+      /* Set up item factory to go away with the window */
+      gtk_object_ref (GTK_OBJECT (item_factory));
+      gtk_object_sink (GTK_OBJECT (item_factory));
+      g_object_set_data_full (G_OBJECT (window),
+                              "<main>",
+                              item_factory,
+                              (GDestroyNotify) g_object_unref);
+
+      /* create menu items */
+      gtk_item_factory_create_items (item_factory, G_N_ELEMENTS (menu_items),
+                                     menu_items, window);
+
+      gtk_table_attach (GTK_TABLE (table),
+                        gtk_item_factory_get_widget (item_factory, "<main>"),
+                        /* X direction */          /* Y direction */
+                        0, 1,                      0, 1,
+                        GTK_EXPAND | GTK_FILL,     0,
+                        0,                         0);
+
+      /* Create the toolbar
+       */
+      toolbar = gtk_toolbar_new ();
+
+      gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                                GTK_STOCK_OPEN,
+                                "This is a demo button with an 'open' icon",
+                                NULL,
+                                G_CALLBACK (toolbar_cb),
+                                window, /* user data for callback */
+                                -1);  /* -1 means "append" */
+
+      gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                                GTK_STOCK_QUIT,
+                                "This is a demo button with a 'quit' icon",
+                                NULL,
+                                G_CALLBACK (toolbar_cb),
+                                window, /* user data for callback */
+                                -1);  /* -1 means "append" */
+
+      gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+
+      gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                                "demo-gtk-logo",
+                                "This is a demo button with a 'gtk' icon",
+                                NULL,
+                                G_CALLBACK (toolbar_cb),
+                                window, /* user data for callback */
+                                -1);  /* -1 means "append" */
+
+      gtk_table_attach (GTK_TABLE (table),
+                        toolbar,
+                        /* X direction */       /* Y direction */
+                        0, 1,                   1, 2,
+                        GTK_EXPAND | GTK_FILL,  0,
+                        0,                      0);
+
+      /* Create document
+       */
+
+      sw = gtk_scrolled_window_new (NULL, NULL);
+
+      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
+
+      gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+                                           GTK_SHADOW_IN);
+      
+      gtk_table_attach (GTK_TABLE (table),
+                        sw,
+                        /* X direction */       /* Y direction */
+                        0, 1,                   2, 3,
+                        GTK_EXPAND | GTK_FILL,  GTK_EXPAND | GTK_FILL,
+                        0,                      0);
+
+      gtk_window_set_default_size (GTK_WINDOW (window),
+                                   200, 200);
+      
+      contents = gtk_text_view_new ();
+
+      gtk_container_add (GTK_CONTAINER (sw),
+                         contents);
+
+      /* Create statusbar */
+
+      statusbar = gtk_statusbar_new ();
+      gtk_table_attach (GTK_TABLE (table),
+                        statusbar,
+                        /* X direction */       /* Y direction */
+                        0, 1,                   3, 4,
+                        GTK_EXPAND | GTK_FILL,  0,
+                        0,                      0);
+
+      /* Show text widget info in the statusbar */
+      buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
+      
+      g_signal_connectc (G_OBJECT (buffer),
+                         "changed",
+                         G_CALLBACK (update_statusbar),
+                         statusbar, FALSE);
+
+      g_signal_connectc (G_OBJECT (buffer),
+                         "mark_set", /* cursor moved */
+                         G_CALLBACK (mark_set_callback),
+                         statusbar, FALSE);
+      
+      update_statusbar (buffer, GTK_STATUSBAR (statusbar));
+    }
+
+  if (!GTK_WIDGET_VISIBLE (window))
+    {
+      gtk_widget_show_all (window);
+    }
+  else
+    {    
+      gtk_widget_destroy (window);
+      window = NULL;
+    }
+
+  return window;
+}
+
index f6e934d5e6f4ccf1aeec787aa70da7232ec21e70..63c622b93c1e5d9a7bed9ed304ccf05d4da80609 100644 (file)
Binary files a/demos/gtk-demo/gtk-logo-rgb.gif and b/demos/gtk-demo/gtk-logo-rgb.gif differ
index a7afa14cf0eb0a7b8a738bbd40232cab9a7b5098..6175d38a7bc5a31786c9c675a58db9ae6a175143 100644 (file)
@@ -323,9 +323,32 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
 * GdkColorContext is gone; you probably weren't using it anyway.
   Use GdkColormap and the gdk_rgb_* functions instead.
 
+* GtkMenuBar now draws the GtkContainer::border_width space outside
+  the frame, not inside the frame
+
+* In GTK 1.2, if an event handler returned TRUE it prevented
+  propagation of that event to parent widgets. That is, the 
+  event signal would not be emitted on parent widgets. In 
+  GTK 2.0, if an event handler returns TRUE, the current signal 
+  emission on the current widget is immediately stopped. That is,
+  other callbacks connected to the signal will not be invoked.
+
+* gtk_toolbar_new() no longer has arguments. This function 
+  was broken because the default GtkToolbarStyle (icons, text, both)
+  is now a user preference, which is overridden when you call
+  gtk_toolbar_set_style(). The constructor forced everyone to 
+  override the preference, which was undesirable. So to port
+  your app, decide if you want to force the toolbar style 
+  or conform to the user's global defaults; if you want to force
+  it, call gtk_toolbar_set_style().
+
+  The orientation arg was removed from toolbar_new() as well, just
+  because it wasn't very useful and we were breaking the function
+  anyway so had an opportunity to lose it. Call
+  gtk_toolbar_set_orientation() to set toolbar orientation.
+
 * GtkRange/GtkScrollbar/GtkScale were rewritten; this means that most
   theme engines won't draw them properly, and any custom subclasses of
   these widgets will need a rewrite (though if you could figure out
   how to subclass the old version of GtkRange, you have our
   respect). Also, GtkTroughType is gone.
-
index f7a02ac08b3461e71eb9281e34103cb78e3b2f42..5b1b92715b68ed9167bdd2b936dd6e3866241915 100644 (file)
@@ -343,6 +343,24 @@ Use to get the value of a GtkArg whose GtkType is GTK_TYPE_C_FOREIGN
 </para>
 
 
+<!-- ##### USER_FUNCTION GtkArgGetFunc ##### -->
+<para>
+Define a function pointer.  Deprecated.
+</para>
+
+@object: 
+@arg: 
+@arg_id: 
+
+<!-- ##### USER_FUNCTION GtkArgSetFunc ##### -->
+<para>
+Define a function pointer.  Deprecated.
+</para>
+
+@object: 
+@arg: 
+@arg_id: 
+
 <!-- ##### ARG GtkContainer:reallocate-redraws ##### -->
 <para>
 
index e96aba29a17461ee3b2f9eeadd310aac4fa1c759..97c9f6329dc7996eaa103e9de312cf9e1548e0fb 100644 (file)
@@ -78,9 +78,10 @@ SPACE is just a space in the style of the toolbar's GtkToolbarSpaceStyle. BUTTON
 creates a new toolbar. 
 </para>
 
+@Returns: the newly created toolbar.
+<!-- # Unused Parameters # -->
 @orientation: a #GtkOrientation. It determines whether the toolbar appears horizontally or vertically.
 @style: a #GtkToolbarStyle. It determines if the toolbar will contain buttons with just labels, just images, or both.
-@Returns: the newly created toolbar.
 
 
 <!-- ##### FUNCTION gtk_toolbar_append_item ##### -->
index e6a3ad7abf01c3cbbc7aaefd9be0a16fdf318e1a..5b35e66bcf3104c870e01bf339d555148e3dba21 100644 (file)
@@ -217,26 +217,6 @@ Define a function pointer.
 </para>
 
 
-<!-- ##### USER_FUNCTION GtkArgGetFunc ##### -->
-<para>
-Define a function pointer.  Deprecated.
-</para>
-
-@object: 
-@arg: 
-@arg_id: 
-
-
-<!-- ##### USER_FUNCTION GtkArgSetFunc ##### -->
-<para>
-Define a function pointer.  Deprecated.
-</para>
-
-@object: 
-@arg: 
-@arg_id: 
-
-
 <!-- ##### TYPEDEF GtkTypeObject ##### -->
 <para>
 A GtkTypeObject defines the minimum structure requirements
index edeb03b1a582ee9c75e9976d78bb75a16bf70879..06960c42dac636271d909e09fe089aa5d19079f0 100644 (file)
@@ -1,3 +1,9 @@
+2001-05-08  Havoc Pennington  <hp@redhat.com>
+
+       * gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): docs fixup, 
+       and fix behavior to still subst color if the original image 
+       had alpha
+
 2001-06-04  Havoc Pennington  <hp@redhat.com>
 
        * io-pnm.c (pnm_skip_whitespace): patch from Szekeres Istvan,
index 0f869b94716f11ba786b36ce5b3013b787378a9c..16c32bb2b7818dded0a3722a88295df10fdd4218 100644 (file)
 /**
  * gdk_pixbuf_add_alpha:
  * @pixbuf: A pixbuf.
- * @substitute_color: Whether to substitute a color for zero opacity.  If this
+ * @substitute_color: Whether to set a color to zero opacity.  If this
  * is #FALSE, then the (@r, @g, @b) arguments will be ignored.
  * @r: Red value to substitute.
  * @g: Green value to substitute.
  * @b: Blue value to substitute.
  *
- * Takes an existing pixbuf and adds an alpha channel to it.  If the original
- * pixbuf already had alpha information, then the contents of the new pixbuf are
- * exactly the same as the original's.  Otherwise, the new pixbuf will have all
- * pixels with full opacity if @substitute_color is #FALSE.  If
- * @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
- * substituted for zero opacity.
+ * Takes an existing pixbuf and adds an alpha channel to it.
+ * If the existing pixbuf already had an alpha channel, the channel
+ * values are copied from the original; otherwise, the alpha channel
+ * is initialized to 255 (full opacity).
+ * 
+ * If @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
+ * assigned zero opacity. That is, if you pass (255, 255, 255) for the
+ * substitute color, all white pixels will become fully transparent.
  *
  * Return value: A newly-created pixbuf with a reference count of 1.
  **/
@@ -62,10 +64,12 @@ gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
                if (!new_pixbuf)
                        return NULL;
 
-               return new_pixbuf;
-       }
-
-       new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
+                if (!substitute_color)
+                        return new_pixbuf;
+       } else {
+                new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
+        }
+        
        if (!new_pixbuf)
                return NULL;
 
@@ -75,16 +79,26 @@ gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
 
                src = pixbuf->pixels + y * pixbuf->rowstride;
                dest = new_pixbuf->pixels + y * new_pixbuf->rowstride;
-
-               for (x = 0; x < pixbuf->width; x++) {
-                       tr = *dest++ = *src++;
-                       tg = *dest++ = *src++;
-                       tb = *dest++ = *src++;
-
-                       if (substitute_color && tr == r && tg == g && tb == b)
-                               *dest++ = 0;
-                       else
-                               *dest++ = 255;
+                
+                if (pixbuf->has_alpha) {
+                        /* Just subst color, we already copied everything else */
+                        for (x = 0; x < pixbuf->width; x++) {
+                                if (src[0] == r && src[1] == g && src[2] == b)
+                                        dest[3] = 0;
+                                src += 4;
+                                dest += 4;
+                        }
+                } else {                        
+                        for (x = 0; x < pixbuf->width; x++) {
+                                tr = *dest++ = *src++;
+                                tg = *dest++ = *src++;
+                                tb = *dest++ = *src++;
+                                
+                                if (substitute_color && tr == r && tg == g && tb == b)
+                                        *dest++ = 0;
+                                else
+                                        *dest++ = 255;
+                        }
                }
        }
 
index ab931ad82e5b5ac5dfd38a8342131eb0a8e52ae2..305f7b6157811e7b67182330d21565c7ef85140f 100644 (file)
@@ -1913,6 +1913,9 @@ static struct
 } settings_map[] = {
   { "Net/DoubleClickTime", "gtk-double-click-timeout" },
   { "Net/DragThreshold", "gtk-drag-threshold" },
+  { "Gtk/ColorPalette", "gtk-color-palette" },
+  { "Gtk/ToolbarStyle", "gtk-toolbar-style" },
+  { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" },
   { "Net/CursorBlink", "gtk-cursor-blink" },
   { "Net/CursorBlinkTime", "gtk-cursor-blink-time" }
 };
index f14e2654d9d8e6bc1030376fd4acd21a99ba0167..02f847d7c361010bf6a143e7bdce5a0b35a62989 100644 (file)
@@ -126,6 +126,9 @@ struct _ColorSelectionPrivate
 
   /* Window for grabbing on */
   GtkWidget *dropper_grab_widget;
+
+  /* Connection to settings */
+  guint settings_connection;
 };
 
 
@@ -1621,6 +1624,7 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
 {
   GtkObjectClass *object_class;
   GObjectClass *gobject_class;
+  gchar *palette;
   
   object_class = GTK_OBJECT_CLASS (klass);
   gobject_class = G_OBJECT_CLASS (klass);
@@ -1644,8 +1648,14 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
                                                       _("Palette to use in the color selector"),
                                                       default_colors,
                                                       G_PARAM_READWRITE));
+
+  g_object_get (G_OBJECT (gtk_settings_get_global ()),
+                "gtk-color-palette",
+                &palette,
+                NULL);
   
-  fill_palette_from_string (default_colors);
+  fill_palette_from_string (palette);
+  g_free (palette);
 
   change_palette_hook = default_change_palette_func;
   
@@ -1813,11 +1823,12 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
   /* Set default colors */
 
   update_palette (colorsel);
-  
-  g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
-                         "notify::gtk-color-palette",
-                         G_CALLBACK (palette_change_notify_instance),
-                         colorsel, NULL, FALSE, FALSE);
+
+  priv->settings_connection = 
+    g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
+                           "notify::gtk-color-palette",
+                           G_CALLBACK (palette_change_notify_instance),
+                           colorsel, NULL, FALSE, FALSE);
   
   /* hide unused stuff */
   
@@ -1862,6 +1873,13 @@ gtk_color_selection_finalize (GObject *object)
   
   if (cselection->private_data)
     {
+      ColorSelectionPrivate *priv;
+
+      priv = cselection->private_data;
+
+      g_signal_handler_disconnect (gtk_settings_get_global (),
+                                   priv->settings_connection);
+      
       g_free (cselection->private_data);
       cselection->private_data = NULL;
     }
index f4d025a04150c1f08ba1adf90f4aa8c6b15b2680..697281f75398243bb97bf1a5b0b8f5c13fe8120e 100644 (file)
@@ -313,7 +313,7 @@ gtk_icon_factory_lookup_default (const gchar *stock_id)
 
       if (icon_set)
         return icon_set;
-
+      
       tmp_list = g_slist_next (tmp_list);
     }
 
index 961663842218175d1389fccc8adfa221f64c2654..9965fef932d4b61a947fb74ce24c186d2f2b950d 100644 (file)
@@ -37,7 +37,7 @@
 
 #define BORDER_SPACING  0
 #define CHILD_SPACING   3
-
+#define DEFAULT_IPADDING 1
 
 static void gtk_menu_bar_class_init    (GtkMenuBarClass *klass);
 static void gtk_menu_bar_size_request  (GtkWidget       *widget,
@@ -136,6 +136,16 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
                                                               GTK_TYPE_SHADOW_TYPE,
                                                               GTK_SHADOW_OUT,
                                                               G_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                          g_param_spec_int ("internal_padding",
+                                                            _("Internal padding"),
+                                                            _("Amount of border space between the menubar shadow and the menu items"),
+                                                            0,
+                                                            G_MAXINT,
+                                                             DEFAULT_IPADDING,
+                                                             G_PARAM_READABLE));
+
 }
  
 GtkWidget*
@@ -177,6 +187,7 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
   GList *children;
   gint nchildren;
   GtkRequisition child_requisition;
+  gint ipadding;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -184,7 +195,7 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
 
   requisition->width = 0;
   requisition->height = 0;
-
+  
   if (GTK_WIDGET_VISIBLE (widget))
     {
       menu_bar = GTK_MENU_BAR (widget);
@@ -222,11 +233,15 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
            }
        }
 
+      gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+      
       requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
                             widget->style->xthickness +
+                             ipadding + 
                             BORDER_SPACING) * 2;
       requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
                              widget->style->ythickness +
+                              ipadding +
                              BORDER_SPACING) * 2;
 
       if (nchildren > 0)
@@ -245,6 +260,7 @@ gtk_menu_bar_size_allocate (GtkWidget     *widget,
   GtkAllocation child_allocation;
   GtkRequisition child_requisition;
   guint offset;
+  gint ipadding;
   
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -259,15 +275,19 @@ gtk_menu_bar_size_allocate (GtkWidget     *widget,
                            allocation->x, allocation->y,
                            allocation->width, allocation->height);
 
+  gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+  
   if (menu_shell->children)
     {
       child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
                            widget->style->xthickness +
+                            ipadding + 
                            BORDER_SPACING);
       offset = child_allocation.x;     /* Window edge to menubar start */
 
       child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
                            widget->style->ythickness +
+                            ipadding +
                            BORDER_SPACING);
       child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
 
@@ -314,13 +334,18 @@ gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area)
 
   if (GTK_WIDGET_DRAWABLE (widget))
     {
+      gint border;
+
+      border = GTK_CONTAINER (widget)->border_width;
+      
       gtk_paint_box (widget->style,
                     widget->window,
-                    GTK_STATE_NORMAL,
+                     GTK_WIDGET_STATE (widget),
                      get_shadow_type (GTK_MENU_BAR (widget)),
                     area, widget, "menubar",
-                    0, 0,
-                    -1,-1);
+                    border, border,
+                    widget->allocation.width - border * 2,
+                     widget->allocation.height - border * 2);
     }
 }
 
index ee5c187dbef182fc83bb3f5d04a6bb31b08b711a..3fe8f49277333e91f2ce007866c60c1de0b6b1c7 100644 (file)
@@ -219,10 +219,58 @@ gtk_settings_get_property (GObject     *object,
 {
   GtkSettings *settings = GTK_SETTINGS (object);
 
-  if (gdk_setting_get (pspec->name, value))
-    g_param_value_validate (pspec, value);
+  if (g_value_type_transformable (G_TYPE_INT, G_VALUE_TYPE (value)) ||
+      g_value_type_transformable (G_TYPE_STRING, G_VALUE_TYPE (value)) ||
+      g_value_type_transformable (GDK_TYPE_COLOR, G_VALUE_TYPE (value)))
+    {
+      if (gdk_setting_get (pspec->name, value))
+        g_param_value_validate (pspec, value);
+      else
+        g_value_copy (settings->property_values + property_id - 1, value);
+    }
   else
-    g_value_copy (settings->property_values + property_id - 1, value);
+    {
+      GValue val = { 0, };
+
+      /* Try to get xsetting as a string and parse it. */
+      
+      g_value_init (&val, G_TYPE_STRING);
+
+      if (!gdk_setting_get (pspec->name, &val))
+        {
+          g_value_copy (settings->property_values + property_id - 1, value);
+        }
+      else
+        {
+          GValue tmp_value = { 0, };
+          GValue gstring_value = { 0, };
+          GtkRcPropertyParser parser = g_param_spec_get_qdata (pspec,
+                                                               quark_property_parser);
+          
+          g_value_init (&gstring_value, G_TYPE_GSTRING);
+
+          g_value_set_boxed (&gstring_value,
+                             g_string_new (g_value_get_string (&val)));
+
+          g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+
+          if (parser && _gtk_settings_parse_convert (parser, &gstring_value,
+                                                     pspec, &tmp_value))
+            {
+              g_value_copy (&tmp_value, value);
+              g_param_value_validate (pspec, value);
+            }
+          else
+            {
+              g_value_copy (settings->property_values + property_id - 1, value);
+            }
+
+          g_value_unset (&gstring_value);
+          g_value_unset (&tmp_value);
+        }
+
+      g_value_unset (&val);
+    }
 }
 
 static void
@@ -359,9 +407,11 @@ settings_install_property_parser (GtkSettingsClass   *class,
       break;
     default:
       if (!parser)
-       g_warning (G_STRLOC ": parser needs to be specified for property \"%s\" of type `%s'",
-                  pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
-      return 0;
+        {
+          g_warning (G_STRLOC ": parser needs to be specified for property \"%s\" of type `%s'",
+                     pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
+          return 0;
+        }
     }
   if (g_object_class_find_property (G_OBJECT_CLASS (class), pspec->name))
     {
@@ -617,7 +667,7 @@ gtk_rc_property_parse_enum (const GParamSpec *pspec,
   if (scanner->token == G_TOKEN_IDENTIFIER)
     {
       GEnumClass *class = G_PARAM_SPEC_ENUM (pspec)->enum_class;
-
+      
       enum_value = g_enum_get_value_by_name (class, scanner->value.v_identifier);
       if (!enum_value)
        enum_value = g_enum_get_value_by_nick (class, scanner->value.v_identifier);
@@ -820,7 +870,7 @@ void
 _gtk_settings_handle_event (GdkEventSetting *event)
 {
   GtkSettings *settings = gtk_settings_get_global ();
-
+  
   if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name))
     g_object_notify (G_OBJECT (settings), event->name);
 }
index 1ca1466ffa72d65d43815be18238c16570fa63f7..a032eb7fadff31e77a24a75cecab56a17239d41d 100644 (file)
@@ -30,6 +30,7 @@
 #include "gtksignal.h"
 #include "gtkstatusbar.h"
 #include "gtkwindow.h"
+#include "gtkintl.h"
 
 typedef struct _GtkStatusbarMsg GtkStatusbarMsg;
 
@@ -63,6 +64,10 @@ static gboolean gtk_statusbar_button_press   (GtkWidget         *widget,
                                              GdkEventButton    *event);
 static gboolean gtk_statusbar_expose_event   (GtkWidget         *widget,
                                              GdkEventExpose    *event);
+static void     gtk_statusbar_size_request   (GtkWidget         *widget,
+                                              GtkRequisition    *requisition);
+static void     gtk_statusbar_size_allocate  (GtkWidget         *widget,
+                                              GtkAllocation     *allocation);
 static void     gtk_statusbar_create_window  (GtkStatusbar      *statusbar);
 static void     gtk_statusbar_destroy_window (GtkStatusbar      *statusbar);
 
@@ -109,8 +114,6 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
   
   object_class->destroy = gtk_statusbar_destroy;
 
-  widget_class->size_allocate = gtk_statusbar_size_allocate;
-  
   widget_class->realize = gtk_statusbar_realize;
   widget_class->unrealize = gtk_statusbar_unrealize;
   widget_class->map = gtk_statusbar_map;
@@ -118,6 +121,9 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
   
   widget_class->button_press_event = gtk_statusbar_button_press;
   widget_class->expose_event = gtk_statusbar_expose_event;
+
+  widget_class->size_request = gtk_statusbar_size_request;
+  widget_class->size_allocate = gtk_statusbar_size_allocate;
   
   class->messages_mem_chunk = g_mem_chunk_new ("GtkStatusBar messages mem chunk",
                                               sizeof (GtkStatusbarMsg),
@@ -145,27 +151,42 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
                    GTK_TYPE_NONE, 2,
                    GTK_TYPE_UINT,
                    GTK_TYPE_STRING);
+
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("shadow_type",
+                                                              _("Shadow type"),
+                                                              _("Style of bevel around the statusbar text"),
+                                                              GTK_TYPE_SHADOW_TYPE,
+                                                              GTK_SHADOW_IN,
+                                                              G_PARAM_READABLE));
 }
 
 static void
 gtk_statusbar_init (GtkStatusbar *statusbar)
 {
   GtkBox *box;
-
+  GtkShadowType shadow_type;
+  
   box = GTK_BOX (statusbar);
 
   box->spacing = 2;
   box->homogeneous = FALSE;
 
   statusbar->has_resize_grip = TRUE;
+
+  gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow_type", &shadow_type, NULL);
   
   statusbar->frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), GTK_SHADOW_IN);
+  gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
   gtk_box_pack_start (box, statusbar->frame, TRUE, TRUE, 0);
   gtk_widget_show (statusbar->frame);
 
   statusbar->label = gtk_label_new ("");
   gtk_misc_set_alignment (GTK_MISC (statusbar->label), 0.0, 0.0);
+  /* don't expand the size request for the label; if we
+   * do that then toplevels weirdly resize
+   */
+  gtk_widget_set_usize (statusbar->label, 1, -1);
   gtk_container_add (GTK_CONTAINER (statusbar->frame), statusbar->label);
   gtk_widget_show (statusbar->label);
 
@@ -425,25 +446,6 @@ get_grip_rect (GtkStatusbar *statusbar,
   rect->height = h;
 }
 
-static void
-gtk_statusbar_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
-{
-  GtkStatusbar *statusbar;
-  GdkRectangle rect;
-  
-  statusbar = GTK_STATUSBAR (widget);
-  
-  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
-
-  get_grip_rect (statusbar, &rect);
-  
-  if (statusbar->grip_window)
-    gdk_window_move_resize (statusbar->grip_window,
-                            rect.x, rect.y,
-                            rect.width, rect.height);
-}
-
 static void
 gtk_statusbar_create_window (GtkStatusbar *statusbar)
 {
@@ -583,7 +585,7 @@ gtk_statusbar_expose_event (GtkWidget      *widget,
   if (statusbar->has_resize_grip)
     {
       get_grip_rect (statusbar, &rect);
-      
+
       gtk_paint_resize_grip (widget->style,
                              widget->window,
                              GTK_WIDGET_STATE (widget),
@@ -601,3 +603,68 @@ gtk_statusbar_expose_event (GtkWidget      *widget,
 
   return FALSE;
 }
+
+static void
+gtk_statusbar_size_request   (GtkWidget      *widget,
+                              GtkRequisition *requisition)
+{
+  GtkStatusbar *statusbar;
+  GtkShadowType shadow_type;
+  
+  statusbar = GTK_STATUSBAR (widget);
+
+  gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow_type", &shadow_type, NULL);  
+  gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
+  
+  GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+
+  if (statusbar->has_resize_grip)
+    {
+      GdkRectangle rect;
+
+      /* x, y in the grip rect depend on size allocation, but
+       * w, h do not so this is OK
+       */
+      get_grip_rect (statusbar, &rect);
+      
+      requisition->width += rect.width;
+      requisition->height = MAX (requisition->height, rect.height);
+    }
+}
+
+static void
+gtk_statusbar_size_allocate  (GtkWidget     *widget,
+                              GtkAllocation *allocation)
+{
+  GtkStatusbar *statusbar;
+  
+  statusbar = GTK_STATUSBAR (widget);
+
+  if (statusbar->has_resize_grip)
+    {
+      GdkRectangle rect;
+      GtkAllocation hbox_allocation;
+      GtkRequisition saved_req;
+      
+      widget->allocation = *allocation; /* get_grip_rect needs this info */
+      get_grip_rect (statusbar, &rect);
+  
+      if (statusbar->grip_window)
+        gdk_window_move_resize (statusbar->grip_window,
+                                rect.x, rect.y,
+                                rect.width, rect.height);
+      
+      /* enter the bad hack zone */      
+      saved_req = widget->requisition;
+      widget->requisition.width -= rect.width; /* HBox::size_allocate needs this */
+      if (widget->requisition.width < 0)
+        widget->requisition.width = 0;
+      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+      widget->requisition = saved_req;
+    }
+  else
+    {
+      /* chain up normally */
+      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+    }
+}
index 6aaf3305493d1ba219ba5f13376aef8dd5498737..e0c526ecd9644f9a010e676cd94dd3066c97290f 100644 (file)
@@ -2116,103 +2116,188 @@ gtk_default_draw_shadow (GtkStyle      *style,
       break;
       
     case GTK_SHADOW_IN:
-      gdk_draw_line (window, gc1,
-                     x, y + height - 1, x + width - 1, y + height - 1);
-      gdk_draw_line (window, gc1,
-                     x + width - 1, y, x + width - 1, y + height - 1);
-      
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + 1, y + height - 2, x + width - 2, y + height - 2);
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + width - 2, y + 1, x + width - 2, y + height - 2);
-      
-      gdk_draw_line (window, style->black_gc,
-                     x + 1, y + 1, x + width - 2, y + 1);
-      gdk_draw_line (window, style->black_gc,
-                     x + 1, y + 1, x + 1, y + height - 2);
-      
-      gdk_draw_line (window, gc2,
-                     x, y, x + width - 1, y);
-      gdk_draw_line (window, gc2,
-                     x, y, x, y + height - 1);
+      /* Light around right and bottom edge */
+
+      if (style->ythickness > 0)
+        gdk_draw_line (window, gc1,
+                       x, y + height - 1, x + width - 1, y + height - 1);
+      if (style->xthickness > 0)
+        gdk_draw_line (window, gc1,
+                       x + width - 1, y, x + width - 1, y + height - 1);
+
+      if (style->ythickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + 1, y + height - 2, x + width - 2, y + height - 2);
+      if (style->xthickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + width - 2, y + 1, x + width - 2, y + height - 2);
+
+      /* Dark around left and top */
+
+      if (style->ythickness > 1)
+        gdk_draw_line (window, style->black_gc,
+                       x + 1, y + 1, x + width - 2, y + 1);
+      if (style->xthickness > 1)
+        gdk_draw_line (window, style->black_gc,
+                       x + 1, y + 1, x + 1, y + height - 2);
+
+      if (style->ythickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x + width - 1, y);
+      if (style->xthickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x, y + height - 1);
       break;
       
     case GTK_SHADOW_OUT:
-      gdk_draw_line (window, gc1,
-                     x + 1, y + height - 2, x + width - 2, y + height - 2);
-      gdk_draw_line (window, gc1,
-                     x + width - 2, y + 1, x + width - 2, y + height - 2);
-      
-      gdk_draw_line (window, gc2,
-                     x, y, x + width - 1, y);
-      gdk_draw_line (window, gc2,
-                     x, y, x, y + height - 1);
-      
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + 1, y + 1, x + width - 2, y + 1);
-      gdk_draw_line (window, style->bg_gc[state_type],
-                     x + 1, y + 1, x + 1, y + height - 2);
+      /* Dark around right and bottom edge */
+
+      if (style->ythickness > 0)
+        {
+          if (style->ythickness > 1)
+            {
+              gdk_draw_line (window, gc1,
+                             x + 1, y + height - 2, x + width - 2, y + height - 2);
+              gdk_draw_line (window, style->black_gc,
+                             x, y + height - 1, x + width - 1, y + height - 1);
+            }
+          else
+            {
+              gdk_draw_line (window, gc1,
+                             x + 1, y + height - 1, x + width - 1, y + height - 1);
+            }
+        }
+
+      if (style->xthickness > 0)
+        {
+          if (style->xthickness > 1)
+            {
+              gdk_draw_line (window, gc1,
+                             x + width - 2, y + 1, x + width - 2, y + height - 2);
+              
+              gdk_draw_line (window, style->black_gc,
+                             x + width - 1, y, x + width - 1, y + height - 1);
+            }
+          else
+            {
+              gdk_draw_line (window, gc1,
+                             x + width - 1, y + 1, x + width - 1, y + height - 1);
+            }
+        }
       
-      gdk_draw_line (window, style->black_gc,
-                     x, y + height - 1, x + width - 1, y + height - 1);
-      gdk_draw_line (window, style->black_gc,
-                     x + width - 1, y, x + width - 1, y + height - 1);
+      /* Light around top and left */
+
+      if (style->ythickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x + width - 1, y);
+      if (style->xthickness > 0)
+        gdk_draw_line (window, gc2,
+                       x, y, x, y + height - 1);
+
+      if (style->ythickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + 1, y + 1, x + width - 2, y + 1);
+      if (style->xthickness > 1)
+        gdk_draw_line (window, style->bg_gc[state_type],
+                       x + 1, y + 1, x + 1, y + height - 2);
       break;
       
     case GTK_SHADOW_ETCHED_IN:
     case GTK_SHADOW_ETCHED_OUT:
-      thickness_light = 1;
-      thickness_dark = 1;
+      if (style->xthickness > 0)
+        {
+          if (style->xthickness > 1)
+            {
+              thickness_light = 1;
+              thickness_dark = 1;
       
-      for (i = 0; i < thickness_dark; i++)
+              for (i = 0; i < thickness_dark; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + width - i - 1,
+                                 y + i,
+                                 x + width - i - 1,
+                                 y + height - i - 1);
+                  gdk_draw_line (window, gc2,
+                                 x + i,
+                                 y + i,
+                                 x + i,
+                                 y + height - i - 2);
+                }
+      
+              for (i = 0; i < thickness_light; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + thickness_dark + i,
+                                 y + thickness_dark + i,
+                                 x + thickness_dark + i,
+                                 y + height - thickness_dark - i - 1);
+                  gdk_draw_line (window, gc2,
+                                 x + width - thickness_light - i - 1,
+                                 y + thickness_dark + i,
+                                 x + width - thickness_light - i - 1,
+                                 y + height - thickness_light - 1);
+                }
+            }
+          else
+            {
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x, y, x, y + height);                         
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x + width, y, x + width, y + height);
+            }
+        }
+
+      if (style->ythickness > 0)
         {
-          gdk_draw_line (window, gc1,
-                         x + i,
-                         y + height - i - 1,
-                         x + width - i - 1,
-                         y + height - i - 1);
-          gdk_draw_line (window, gc1,
-                         x + width - i - 1,
-                         y + i,
-                         x + width - i - 1,
-                         y + height - i - 1);
+          if (style->ythickness > 1)
+            {
+              thickness_light = 1;
+              thickness_dark = 1;
+      
+              for (i = 0; i < thickness_dark; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + i,
+                                 y + height - i - 1,
+                                 x + width - i - 1,
+                                 y + height - i - 1);
           
-          gdk_draw_line (window, gc2,
-                         x + i,
-                         y + i,
-                         x + width - i - 2,
-                         y + i);
-          gdk_draw_line (window, gc2,
-                         x + i,
-                         y + i,
-                         x + i,
-                         y + height - i - 2);
-        }
+                  gdk_draw_line (window, gc2,
+                                 x + i,
+                                 y + i,
+                                 x + width - i - 2,
+                                 y + i);
+                }
       
-      for (i = 0; i < thickness_light; i++)
-        {
-          gdk_draw_line (window, gc1,
-                         x + thickness_dark + i,
-                         y + thickness_dark + i,
-                         x + width - thickness_dark - i - 1,
-                         y + thickness_dark + i);
-          gdk_draw_line (window, gc1,
-                         x + thickness_dark + i,
-                         y + thickness_dark + i,
-                         x + thickness_dark + i,
-                         y + height - thickness_dark - i - 1);
+              for (i = 0; i < thickness_light; i++)
+                {
+                  gdk_draw_line (window, gc1,
+                                 x + thickness_dark + i,
+                                 y + thickness_dark + i,
+                                 x + width - thickness_dark - i - 1,
+                                 y + thickness_dark + i);
           
-          gdk_draw_line (window, gc2,
-                         x + thickness_dark + i,
-                         y + height - thickness_light - i - 1,
-                         x + width - thickness_light - 1,
-                         y + height - thickness_light - i - 1);
-          gdk_draw_line (window, gc2,
-                         x + width - thickness_light - i - 1,
-                         y + thickness_dark + i,
-                         x + width - thickness_light - i - 1,
-                         y + height - thickness_light - 1);
+                  gdk_draw_line (window, gc2,
+                                 x + thickness_dark + i,
+                                 y + height - thickness_light - i - 1,
+                                 x + width - thickness_light - 1,
+                                 y + height - thickness_light - i - 1);
+                }
+            }
+          else
+            {
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x, y, x + width, y);
+              gdk_draw_line (window, 
+                             style->dark_gc[state_type],
+                             x, y + height, x + width, y + height);
+            }
         }
+      
       break;
     }
   if (area)
@@ -4157,11 +4242,26 @@ gtk_default_draw_resize_grip (GtkStyle       *style,
     {
       gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
       gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
+      gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
     }
 
-  /* make it square */
-  if (width != height)
-    width = height = MIN (width, height);
+  /* make it square, aligning to bottom right */
+  if (width < height)
+    {
+      y += (height - width);
+      height = width;
+    }
+  else if (height < width)
+    {
+      x += (width - height);
+      width = height;
+    }
+
+  /* Clear background */
+  gdk_draw_rectangle (window,
+                      style->bg_gc[state_type],
+                      TRUE,
+                      x, y, width, height);
   
   switch (edge)
     {
@@ -4209,6 +4309,7 @@ gtk_default_draw_resize_grip (GtkStyle       *style,
     {
       gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
       gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
+      gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
     }
 }
 
index 95b3b4b00a0d0bffafa6a0c295bc241b7d760895..c8299e9ea3d463d41a87b233925f0486e122f8c5 100644 (file)
@@ -76,8 +76,6 @@
  *
  */
 
-#define FOCUS_EDGE_WIDTH 1
-
 #define SCREEN_WIDTH(widget) text_window_get_width (GTK_TEXT_VIEW (widget)->text_window)
 #define SCREEN_HEIGHT(widget) text_window_get_height (GTK_TEXT_VIEW (widget)->text_window)
 
@@ -2236,7 +2234,7 @@ gtk_text_view_get_property (GObject         *object,
     case PROP_EDITABLE:
       g_value_set_boolean (value, text_view->editable);
       break;
-
+      
     case PROP_WRAP_MODE:
       g_value_set_enum (value, text_view->wrap_mode);
       break;
@@ -2277,14 +2275,23 @@ gtk_text_view_size_request (GtkWidget      *widget,
 {
   GtkTextView *text_view;
   GSList *tmp_list;
-
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
   text_view = GTK_TEXT_VIEW (widget);
 
+  gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
   text_view->text_window->requisition.width = text_view->layout->width;
   text_view->text_window->requisition.height = text_view->layout->height;
   
-  requisition->width = text_view->text_window->requisition.width + FOCUS_EDGE_WIDTH * 2;
-  requisition->height = text_view->text_window->requisition.height + FOCUS_EDGE_WIDTH * 2;
+  requisition->width = text_view->text_window->requisition.width + focus_edge_width * 2;
+  requisition->height = text_view->text_window->requisition.height + focus_edge_width * 2;
 
   if (text_view->left_window)
     requisition->width += text_view->left_window->requisition.width;
@@ -2430,7 +2437,9 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   GdkRectangle right_rect;
   GdkRectangle top_rect;
   GdkRectangle bottom_rect;
-
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
   text_view = GTK_TEXT_VIEW (widget);
 
   DV(g_print(G_STRLOC"\n"));
@@ -2448,7 +2457,14 @@ gtk_text_view_size_allocate (GtkWidget *widget,
    * windows get at least a 1x1 allocation.
    */
 
-  width = allocation->width - FOCUS_EDGE_WIDTH * 2;
+  gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
+  width = allocation->width - focus_edge_width * 2;
 
   if (text_view->left_window)
     left_rect.width = text_view->left_window->requisition.width;
@@ -2470,7 +2486,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   bottom_rect.width = text_rect.width;
 
 
-  height = allocation->height - FOCUS_EDGE_WIDTH * 2;
+  height = allocation->height - focus_edge_width * 2;
 
   if (text_view->top_window)
     top_rect.height = text_view->top_window->requisition.height;
@@ -2492,8 +2508,8 @@ gtk_text_view_size_allocate (GtkWidget *widget,
   right_rect.height = text_rect.height;
 
   /* Origins */
-  left_rect.x = FOCUS_EDGE_WIDTH;
-  top_rect.y = FOCUS_EDGE_WIDTH;
+  left_rect.x = focus_edge_width;
+  top_rect.y = focus_edge_width;
 
   text_rect.x = left_rect.x + left_rect.width;
   text_rect.y = top_rect.y + top_rect.height;
@@ -3465,10 +3481,15 @@ gtk_text_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
 static void
 gtk_text_view_draw_focus (GtkWidget *widget)
 {
+  gboolean interior_focus;
+
+  /* We clear the focus if we are in interior focus mode. */
+  gtk_widget_style_get (widget, "interior_focus", &interior_focus, NULL);
+  
   if (GTK_WIDGET_DRAWABLE (widget))
     {
-      if (GTK_WIDGET_HAS_FOCUS (widget))
-        {
+      if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus)
+        {          
           gtk_paint_focus (widget->style, widget->window,
                            NULL, widget, "textview",
                            0, 0,
@@ -5537,16 +5558,26 @@ buffer_to_widget (GtkTextView      *text_view,
                   gint             *window_x,
                   gint             *window_y)
 {
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
+  gtk_widget_style_get (GTK_WIDGET (text_view), "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
   if (window_x)
     {
-      *window_x = buffer_x - text_view->xoffset + FOCUS_EDGE_WIDTH;
+      *window_x = buffer_x - text_view->xoffset + focus_edge_width;
       if (text_view->left_window)
         *window_x += text_view->left_window->allocation.width;
     }
 
   if (window_y)
     {
-      *window_y = buffer_y - text_view->yoffset + FOCUS_EDGE_WIDTH;
+      *window_y = buffer_y - text_view->yoffset + focus_edge_width;
       if (text_view->top_window)
         *window_y += text_view->top_window->allocation.height;
     }
@@ -5674,16 +5705,26 @@ widget_to_buffer (GtkTextView *text_view,
                   gint        *buffer_x,
                   gint        *buffer_y)
 {
+  gint focus_edge_width;
+  gboolean interior_focus;
+  
+  gtk_widget_style_get (GTK_WIDGET (text_view), "interior_focus", &interior_focus, NULL);
+
+  if (interior_focus)
+    focus_edge_width = 0;
+  else
+    focus_edge_width = 1;
+  
   if (buffer_x)
     {
-      *buffer_x = widget_x - FOCUS_EDGE_WIDTH + text_view->xoffset;
+      *buffer_x = widget_x - focus_edge_width + text_view->xoffset;
       if (text_view->left_window)
         *buffer_x -= text_view->left_window->allocation.width;
     }
 
   if (buffer_y)
     {
-      *buffer_y = widget_y - FOCUS_EDGE_WIDTH + text_view->yoffset;
+      *buffer_y = widget_y - focus_edge_width + text_view->yoffset;
       if (text_view->top_window)
         *buffer_y -= text_view->top_window->allocation.height;
     }
index ed8fb0b3b4de01cabce436eed9e3fb4b7ea8cb72..1008c0f0c0663cf4ea9526a80928569276ba7f23 100644 (file)
 #include "gtkstock.h"
 #include "gtkiconfactory.h"
 #include "gtkimage.h"
+#include "gtksettings.h"
 #include "gtkintl.h"
 
 
+#define DEFAULT_IPADDING 0
 #define DEFAULT_SPACE_SIZE  5
-#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_EMPTY
+#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
 
 #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
 
@@ -69,6 +71,7 @@ struct _GtkToolbarChildSpace
 
 static void gtk_toolbar_class_init               (GtkToolbarClass *class);
 static void gtk_toolbar_init                     (GtkToolbar      *toolbar);
+static void gtk_toolbar_finalize                 (GObject         *object);
 static void gtk_toolbar_set_property             (GObject         *object,
                                                  guint            prop_id,
                                                  const GValue    *value,
@@ -88,6 +91,7 @@ static void gtk_toolbar_size_allocate            (GtkWidget       *widget,
                                                  GtkAllocation   *allocation);
 static void gtk_toolbar_style_set                (GtkWidget       *widget,
                                                   GtkStyle        *prev_style);
+static void gtk_toolbar_show_all                 (GtkWidget       *widget);
 static void gtk_toolbar_add                      (GtkContainer    *container,
                                                  GtkWidget       *widget);
 static void gtk_toolbar_remove                   (GtkContainer    *container,
@@ -174,6 +178,8 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
   container_class = (GtkContainerClass *) class;
 
   parent_class = gtk_type_class (gtk_container_get_type ());
+
+  gobject_class->finalize = gtk_toolbar_finalize;
   
   object_class->destroy = gtk_toolbar_destroy;
   gobject_class->set_property = gtk_toolbar_set_property;
@@ -185,6 +191,7 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
   widget_class->size_request = gtk_toolbar_size_request;
   widget_class->size_allocate = gtk_toolbar_size_allocate;
   widget_class->style_set = gtk_toolbar_style_set;
+  widget_class->show_all = gtk_toolbar_show_all;
   
   container_class->add = gtk_toolbar_add;
   container_class->remove = gtk_toolbar_remove;
@@ -238,6 +245,16 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
                                                             G_MAXINT,
                                                              DEFAULT_SPACE_SIZE,
                                                             G_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                          g_param_spec_int ("internal_padding",
+                                                            _("Internal padding"),
+                                                            _("Amount of border space between the toolbar shadow and the buttons"),
+                                                            0,
+                                                            G_MAXINT,
+                                                             DEFAULT_IPADDING,
+                                                             G_PARAM_READABLE));
+  
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_enum ("space_style",
                                                             _("Space style"),
@@ -252,8 +269,66 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
                                                             _("Button relief"),
                                                             _("Type of bevel around toolbar buttons"),
                                                               GTK_TYPE_RELIEF_STYLE,
-                                                              GTK_RELIEF_NORMAL,
+                                                              GTK_RELIEF_NONE,
                                                               G_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("shadow_type",
+                                                              _("Shadow type"),
+                                                              _("Style of bevel around the toolbar"),
+                                                              GTK_TYPE_SHADOW_TYPE,
+                                                              GTK_SHADOW_OUT,
+                                                              G_PARAM_READABLE));
+
+  gtk_settings_install_property (gtk_settings_get_global (),
+                                 g_param_spec_enum ("gtk-toolbar-style",
+                                                    _("Toolbar style"),
+                                                    _("Whether default toolbars have text only, text and icons, icons only, etc."),
+                                                    GTK_TYPE_TOOLBAR_STYLE,
+                                                    GTK_TOOLBAR_BOTH,
+                                                    G_PARAM_READWRITE));
+
+  gtk_settings_install_property (gtk_settings_get_global (),
+                                 g_param_spec_enum ("gtk-toolbar-icon-size",
+                                                    _("Toolbar icon size"),
+                                                    _("Size of icons in default toolbars"),
+                                                    GTK_TYPE_ICON_SIZE,
+                                                    GTK_ICON_SIZE_LARGE_TOOLBAR,
+                                                    G_PARAM_READWRITE));  
+}
+
+static void
+style_change_notify (GObject    *object,
+                     GParamSpec *pspec,
+                     gpointer    data)
+{
+  GtkToolbar *toolbar;
+
+  toolbar = GTK_TOOLBAR (data);
+
+  if (!toolbar->style_set)
+    {
+      /* pretend it was set, then unset, thus reverting to new default */
+      toolbar->style_set = TRUE; 
+      gtk_toolbar_unset_style (toolbar);
+    }
+}
+
+static void
+icon_size_change_notify (GObject    *object,
+                         GParamSpec *pspec,
+                         gpointer    data)
+{
+  GtkToolbar *toolbar;
+
+  toolbar = GTK_TOOLBAR (data);
+
+  if (!toolbar->icon_size_set)
+    {
+      /* pretend it was set, then unset, thus reverting to new default */
+      toolbar->icon_size_set = TRUE; 
+      gtk_toolbar_unset_icon_size (toolbar);
+    }
 }
 
 static void
@@ -265,11 +340,46 @@ gtk_toolbar_init (GtkToolbar *toolbar)
   toolbar->num_children = 0;
   toolbar->children     = NULL;
   toolbar->orientation  = GTK_ORIENTATION_HORIZONTAL;
-  toolbar->style        = GTK_TOOLBAR_ICONS;
   toolbar->icon_size    = DEFAULT_ICON_SIZE;
   toolbar->tooltips     = gtk_tooltips_new ();
   toolbar->button_maxw  = 0;
   toolbar->button_maxh  = 0;
+
+  toolbar->style_set = FALSE;
+  toolbar->icon_size_set = FALSE;
+  g_object_get (gtk_settings_get_global (),
+                "gtk-toolbar-icon-size",
+                &toolbar->icon_size,
+                "gtk-toolbar-style",
+                &toolbar->style,
+                NULL);
+  
+  toolbar->style_set_connection =
+    g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
+                           "notify::gtk-toolbar-style",
+                           G_CALLBACK (style_change_notify),
+                           toolbar, NULL, FALSE, FALSE);
+
+  toolbar->icon_size_connection =
+    g_signal_connect_data (G_OBJECT (gtk_settings_get_global ()),
+                           "notify::gtk-toolbar-icon-size",
+                           G_CALLBACK (icon_size_change_notify),
+                           toolbar, NULL, FALSE, FALSE);  
+}
+
+static void
+gtk_toolbar_finalize (GObject *object)
+{
+  GtkToolbar *toolbar;
+
+  toolbar = GTK_TOOLBAR (object);
+
+  g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_global ()),
+                               toolbar->style_set_connection);
+  g_signal_handler_disconnect (G_OBJECT (gtk_settings_get_global ()),
+                               toolbar->icon_size_connection);
+  
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
@@ -314,16 +424,12 @@ gtk_toolbar_get_property (GObject      *object,
 }
 
 GtkWidget*
-gtk_toolbar_new (GtkOrientation  orientation,
-                GtkToolbarStyle style)
+gtk_toolbar_new (void)
 {
   GtkToolbar *toolbar;
 
   toolbar = gtk_type_new (gtk_toolbar_get_type ());
 
-  toolbar->orientation = orientation;
-  toolbar->style = style;
-
   return GTK_WIDGET (toolbar);
 }
 
@@ -462,15 +568,32 @@ gtk_toolbar_expose (GtkWidget      *widget,
   GtkToolbar *toolbar;
   GList *children;
   GtkToolbarChild *child;
+  gint border_width;
   
   g_return_val_if_fail (widget != NULL, FALSE);
   g_return_val_if_fail (GTK_IS_TOOLBAR (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
 
+  border_width = GTK_CONTAINER (widget)->border_width;
+  
   if (GTK_WIDGET_DRAWABLE (widget))
     {
+      GtkShadowType shadow_type;
+
       toolbar = GTK_TOOLBAR (widget);
 
+      gtk_widget_style_get (widget, "shadow_type", &shadow_type, NULL);
+      
+      gtk_paint_box (widget->style,
+                    widget->window,
+                     GTK_WIDGET_STATE (widget),
+                     shadow_type,
+                    &event->area, widget, "toolbar",
+                    widget->allocation.x + border_width,
+                     widget->allocation.y + border_width,
+                    widget->allocation.width - border_width,
+                     widget->allocation.height - border_width);
+      
       for (children = toolbar->children; children; children = children->next)
        {
          child = children->data;
@@ -502,6 +625,7 @@ gtk_toolbar_size_request (GtkWidget      *widget,
   gint widget_maxw, widget_maxh;
   GtkRequisition child_requisition;
   gint space_size;
+  gint ipadding;
   
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (widget));
@@ -579,6 +703,12 @@ gtk_toolbar_size_request (GtkWidget      *widget,
       requisition->height += nbuttons * button_maxh;
     }
 
+  /* Extra spacing */
+  gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+  
+  requisition->width += 2 * (widget->style->xthickness + ipadding);
+  requisition->height += 2 * (widget->style->ythickness + ipadding);
+  
   toolbar->button_maxw = button_maxw;
   toolbar->button_maxh = button_maxh;
 }
@@ -593,22 +723,29 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
   GtkToolbarChildSpace *child_space;
   GtkAllocation alloc;
   GtkRequisition child_requisition;
-  gint border_width;
+  gint x_border_width, y_border_width;
   gint space_size;
-
+  gint ipadding;
+  
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (widget));
   g_return_if_fail (allocation != NULL);
 
   toolbar = GTK_TOOLBAR (widget);
   widget->allocation = *allocation;
+  
+  x_border_width = GTK_CONTAINER (toolbar)->border_width;
+  y_border_width = GTK_CONTAINER (toolbar)->border_width;
 
-  border_width = GTK_CONTAINER (toolbar)->border_width;
-
+  gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+  
+  x_border_width += 2 * (widget->style->xthickness + ipadding);
+  y_border_width += 2 * (widget->style->ythickness + ipadding);
+  
   if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
-    alloc.x = allocation->x + border_width;
+    alloc.x = allocation->x + x_border_width;
   else
-    alloc.y = allocation->y + border_width;
+    alloc.y = allocation->y + y_border_width;
 
   space_size = get_space_size (toolbar);
   
@@ -697,6 +834,26 @@ gtk_toolbar_style_set (GtkWidget  *widget,
     gtk_toolbar_update_button_relief (GTK_TOOLBAR (widget));
 }
 
+static void
+child_show_all (GtkWidget *widget)
+{
+  /* Don't show our own children, since that would
+   * show labels we may intend to hide in icons-only mode
+   */
+  if (!g_object_get_data (G_OBJECT (widget),
+                          "gtk-toolbar-is-child"))
+    gtk_widget_show_all (widget);
+}
+
+static void
+gtk_toolbar_show_all (GtkWidget *widget)
+{
+  gtk_container_foreach (GTK_CONTAINER (widget),
+                        (GtkCallback) child_show_all,
+                        NULL);
+  gtk_widget_show (widget);
+}
+
 static void
 gtk_toolbar_add (GtkContainer *container,
                 GtkWidget    *widget)
@@ -844,7 +1001,8 @@ gtk_toolbar_insert_item (GtkToolbar    *toolbar,
  *
  * This function sets the size of stock icons in the toolbar. You
  * can call it both before you add the icons and after they've been
- * added.
+ * added. The size you set will override user preferences for the default
+ * icon size.
  **/
 void
 gtk_toolbar_set_icon_size (GtkToolbar  *toolbar,
@@ -858,6 +1016,8 @@ gtk_toolbar_set_icon_size (GtkToolbar  *toolbar,
   g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
+  toolbar->icon_size_set = TRUE;
+  
   if (toolbar->icon_size == icon_size)
     return;
   
@@ -885,6 +1045,31 @@ gtk_toolbar_set_icon_size (GtkToolbar  *toolbar,
   gtk_widget_queue_resize (GTK_WIDGET (toolbar));
 }
 
+/**
+ * gtk_toolbar_unset_icon_size:
+ * @toolbar: a #GtkToolbar
+ * 
+ * Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that
+ * user preferences will be used to determine the icon size.
+ **/
+void
+gtk_toolbar_unset_icon_size (GtkToolbar  *toolbar)
+{
+  GtkIconSize size;
+
+  if (toolbar->icon_size_set)
+    {
+      g_object_get (gtk_settings_get_global (),
+                    "gtk-toolbar-icon-size",
+                    &size, NULL);
+
+      if (size != toolbar->icon_size)
+        gtk_toolbar_set_icon_size (toolbar, size);
+
+      toolbar->icon_size_set = FALSE;
+    }
+}
+
 /**
  * gtk_toolbar_insert_stock:
  * @toolbar: A #GtkToolbar
@@ -1178,6 +1363,13 @@ gtk_toolbar_internal_insert_element (GtkToolbar          *toolbar,
            gtk_widget_show (child->icon);
        }
 
+      if (type != GTK_TOOLBAR_CHILD_WIDGET)
+        {
+          /* Mark child as ours */
+          g_object_set_data (G_OBJECT (child->widget),
+                             "gtk-toolbar-is-child",
+                             GINT_TO_POINTER (TRUE));
+        }
       gtk_widget_show (child->widget);
       break;
 
@@ -1217,7 +1409,6 @@ void
 gtk_toolbar_set_orientation (GtkToolbar     *toolbar,
                             GtkOrientation  orientation)
 {
-  g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
   gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
@@ -1227,12 +1418,40 @@ void
 gtk_toolbar_set_style (GtkToolbar      *toolbar,
                       GtkToolbarStyle  style)
 {
-  g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
+  toolbar->style_set = TRUE;
   gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
 }
 
+/**
+ * gtk_toolbar_unset_style:
+ * @toolbar: a #GtkToolbar
+ * 
+ * Unsets a toolbar style set with gtk_toolbar_set_style(), so that
+ * user preferences will be used to determine the toolbar style.
+ **/
+void
+gtk_toolbar_unset_style (GtkToolbar *toolbar)
+{
+  GtkToolbarStyle style;
+  
+  g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
+  if (toolbar->style_set)
+    {
+      g_object_get (gtk_settings_get_global (),
+                    "gtk-toolbar-style",
+                    &style,
+                    NULL);
+
+      if (style != toolbar->style)
+        gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
+      
+      toolbar->style_set = FALSE;
+    }
+}
+
 void
 gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
                          gboolean    enable)
@@ -1290,7 +1509,7 @@ gtk_real_toolbar_style_changed (GtkToolbar      *toolbar,
   GList *children;
   GtkToolbarChild *child;
   GtkWidget* box = NULL;
-
+  
   g_return_if_fail (toolbar != NULL);
   g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
 
index 19ed1b90c4b239d4a6f5be52c89c81f45e10ef0b..79d3d79dbceaf7d2db7e67871d4f7fd0da9050d8 100644 (file)
@@ -91,6 +91,12 @@ struct _GtkToolbar
 
   gint             button_maxw;
   gint             button_maxh;
+
+  guint            style_set_connection;
+  guint            icon_size_connection;
+  
+  guint            style_set : 1;
+  guint            icon_size_set : 1;
 };
 
 struct _GtkToolbarClass
@@ -105,8 +111,7 @@ struct _GtkToolbarClass
 
 
 GtkType    gtk_toolbar_get_type        (void) G_GNUC_CONST;
-GtkWidget* gtk_toolbar_new             (GtkOrientation   orientation,
-                                       GtkToolbarStyle  style);
+GtkWidget* gtk_toolbar_new             (void);
 
 /* Simple button items */
 GtkWidget* gtk_toolbar_append_item     (GtkToolbar      *toolbar,
@@ -133,8 +138,6 @@ GtkWidget* gtk_toolbar_insert_item     (GtkToolbar      *toolbar,
                                        gint             position);
 
 /* Stock Items */
-void       gtk_toolbar_set_icon_size   (GtkToolbar      *toolbar,
-                                       GtkIconSize      icon_size);
 GtkWidget* gtk_toolbar_insert_stock    (GtkToolbar      *toolbar,
                                        const gchar     *stock_id,
                                        const char      *tooltip_text,
@@ -203,8 +206,12 @@ void       gtk_toolbar_set_orientation       (GtkToolbar           *toolbar,
                                              GtkOrientation        orientation);
 void       gtk_toolbar_set_style             (GtkToolbar           *toolbar,
                                              GtkToolbarStyle       style);
+void       gtk_toolbar_set_icon_size         (GtkToolbar           *toolbar,
+                                              GtkIconSize           icon_size);
 void       gtk_toolbar_set_tooltips          (GtkToolbar           *toolbar,
                                              gboolean              enable);
+void       gtk_toolbar_unset_style           (GtkToolbar           *toolbar);
+void       gtk_toolbar_unset_icon_size       (GtkToolbar           *toolbar);
 
 #ifdef __cplusplus
 }
index 193087613bec3942de781721dadd532010454dc0..956392ae48fac799709c7ee085b0a027f711edb3 100644 (file)
@@ -724,7 +724,7 @@ create_toolbar (void)
       gtk_container_set_border_width (GTK_CONTAINER (window), 0);
       gtk_widget_realize (window);
 
-      toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+      toolbar = gtk_toolbar_new ();
 
       gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
                                GTK_STOCK_NEW,
@@ -825,7 +825,7 @@ make_toolbar (GtkWidget *window)
   if (!GTK_WIDGET_REALIZED (window))
     gtk_widget_realize (window);
 
-  toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+  toolbar = gtk_toolbar_new ();
 
   gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
                           "Horizontal", "Horizontal toolbar layout", NULL,